package jee.boot.oauth;

import jee.boot.common.remote.CrossServiceRequest;
import jee.boot.common.remote.IRemoteEndpoint;
import jee.boot.common.remote.LocalProcessInternalRequest;
import jee.boot.common.remote.ProcessInternalRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

/**
 * 远程请求跨服务配置
 */
@Component
public class RemoteEndpointOverrideConfig {
    @Bean
    public IRemoteEndpoint remoteEndpoint(@Autowired RestTemplate restTemplate, @Autowired LocalProcessInternalRequest localProcessInternalRequest) {
        CrossServiceRequest crossServiceRequest = new CrossServiceRequest();
        ProcessInternalRequest processInternalRequest=new ProcessInternalRequest();
        processInternalRequest.setLocalProcessInternalRequest(localProcessInternalRequest);
        crossServiceRequest.setRestTemplate(restTemplate);
        crossServiceRequest.setProcessInternalRequest(processInternalRequest);
        return crossServiceRequest;
    }
}
